In computing, binary translation is the emulation of one instruction set by another through translation of code. Sequences of instructions are translated from the source to the target instruction set. For example, a program may be written in a high-level programming language and translated into machine code for execution by a particular machine. The conversion process may be done, for example, in a compiler.
Static binary translation is a type of translation where an entire executable file is translated into an executable of the target architecture. This is very difficult to do correctly because not all the code can be discovered by the translator. For example, some parts of the executable may be reachable only through indirect branches whose value is only known at run-time.
Alternatively, dynamic translation looks at a short sequence of code, typically on the order of a single basic block, translates it and caches the resulting sequence. Code is only translated as it is discovered and when possible, branch instructions are made to point to previously translated code.
Dynamic binary Translation differs from simple emulation in that it eliminates the emulator's main read-decode-execute loop (a major performance bottleneck). Of course, elimination of this loop may cause extra overhead during translation time. This overhead is hopefully amortized as translated code sequences are executed multiple times.
In binary or dynamic translation of software code (particularly, machine code), situations may arise where the original code modifies itself. In such situations, to ensure correctness in the case that the software application modified its own original code at runtime, an efficient facility to identify a potentially inconsistent alternative representation of the original code and discard the alternative representation is desired.